import type { ISurveyDB } from "@/types";
import Dexie from "dexie";

class SurveyDatabase extends Dexie {
  surveys!: Dexie.Table<ISurveyDB, number>;

  constructor() {
    // - 数据库名称
    super("SurveyDBDatabase");
    // - 数据库版本
    this.version(1).stores({
      surveys: "++id, createTime, updateTime, title, coms",
    });
  }
}

const surveysDB = new SurveyDatabase();

export { surveysDB };
